<!DOCTYPE html>
<html>
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>登陆</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico">
    <link href="/static/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/static/css/font-awesome.css?v=4.4.0" rel="stylesheet">

    <link href="/static/css/animate.css" rel="stylesheet">
    <link href="/static/css/style.css?v=4.1.0" rel="stylesheet">
    <link rel="stylesheet" href="/static/plugins/bootstrap-validator/css/bootstrapValidator.min.css">
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <script>if(window.top !== window.self){ window.top.location = window.location;}</script>
    <style>
        /* ibox 背景 */
        .ibox-blue > .ibox-title {
            border-color: rgb(57, 174, 245);
        }
        .form-control:focus,
        .single-line:focus {
            border-color: #0e9aef !important;
        }
        .checkbox-inline {
            line-height: 5px;
        }
    </style>
</head>
<body class="gray-bg">

    <div class="middle-box text-center loginscreen  animated fadeInDown">
        <div>
            <div>

                <!--<h2 class="logo-name">OES</h2>-->

            </div>
            <h3>欢迎使用 OES</h3>

            <form id="addForm" class="m-t" role="form" style="text-align: left;">
                <div class="form-group">
                    <input type="text" class="form-control" name="username" placeholder="用户名" value="test" required="">
                </div>
                <div class="form-group">
                    <input type="password" class="form-control" name="password" placeholder="密码" value="d829b843a6550a947e82f2f38ed6b7a7" required="">
                </div>
                <button type="submit" class="btn btn-primary block full-width m-b">登 录</button>


                <p class="text-muted text-center"> <a href="#"><small>忘记密码了？</small></a> | <a href="#">注册一个新账号</a>
                </p>

            </form>
        </div>
    </div>

    <!-- 全局js -->
    <script src="/static/js/jquery.min.js?v=2.1.4"></script>
    <script src="/static/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="/static/js/plugins/layer/layer.min.js"></script>
    <script src="/static/plugins/bootstrap-validator/js/bootstrapValidator.min.js"></script>
    <script src="/static/plugins/bootstrap-validator/js/language/zh_CN.js"></script>
    <script>
        $('#addForm').bootstrapValidator({
            fields: {
                username: {
                    validators: {
                        notEmpty: {
                            message: '用户名不能为空'
                        }
                    }
                },
                password: {
                    validators: {
                        notEmpty: {
                            message: '密码不能为空'
                        }
                    }
                },
//                code: {
//                    validators: {
//                        notEmpty: {
//                            message: '验证码不能为空'
//                        },
//                        stringLength: {
//                            max: 30,
//                            message: '用户名长度最多30个字符'
//                        },
//                        /*remote: {
//                            url: 'remote.php',
//                            message: 'The username is not available'
//                        },*/
//                    }
//                },
            }
        }).on('success.form.bv', function(e) {
            // Prevent form submission
            e.preventDefault();

            $.ajax({
                url: "/admin/loginPost",
                data:  $("#addForm").serialize(),
                type: "POST",
                dataType: 'json',
                success: function(data){
                    if (data.success) {
                        parent.layer.msg(data.msg, {icon: 1});
                        window.location.href = "/admin/index.html";
                    } else {
                        parent.layer.msg(data.msg, {time: 1500, icon:5});
                    }
                }
            });
        });
    </script>
</body>
</html>
